<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.23.
   家居公司优惠活动列表($$)*/

!defined('Q_PATH') && exit;

class Event_C_Controller extends InitController{

	public function index(){
		$arrJiajucompany=$this->_oParent->_arrJiajucompany;
		
		Core_Extend::getSeo($this,array(
			'title'=>"{$arrJiajucompany['jiajucompany_fullname']}最新优惠促销活动",
			'keywords'=>"{$arrJiajucompany['jiajucompany_fullname']}活动,{$arrJiajucompany['jiajucompany_fullname']}优惠促销,{$arrJiajucompany['jiajucompany_fullname']}折扣活动",
			'description'=>"通过{$GLOBALS['_option_']['site_name']}您可以及时准确的了解{$arrJiajucompany['jiajucompany_fullname']}的最新活动促销信息。",
		));

		// 优惠活动列表
		$arrWhere=array();
		$arrWhere['jiajuevent_status']=1;
		$arrWhere['jiajucompany_id']=$arrJiajucompany['jiajucompany_id'];

		$nTotal=Model::F_('jiajuevent')->where($arrWhere)->getCounts();
		$oPage=Page::RUN($nTotal,15,Jiaju_Extend::getEventpageUrl($arrJiajucompany,false));
		$arrEvents=Model::F_('jiajuevent')
			->setColumns('jiajuevent_id,jiajuevent_title,jiajuevent_thumb,jiajuevent_viewnum,jiajuevent_starttime,jiajuevent_endtime,jiajuevent_description')
			->where($arrWhere)
			->order('jiajuevent_id DESC')
			->limit($oPage->S(),$oPage->N())
			->getAll();

		$this->assign('arrEvents',$arrEvents);
		$this->assign('nTotalEvent',$nTotal);
		$this->assign('sPageNavbar',$oPage->P(array('id'=>'pagination','style'=>'li','current'=>'active')));
		$this->display(Jiaju_Extend::getTemplate($arrJiajucompany,'event'));
	}

}
